<template>
  <div>
    <van-nav-bar
      :title="title"
      :left-text="left === 'back' ? '返回' : ''"
      :left-arrow="left === 'back'"
      @click-left="onClickLeft"
      :click-right="onClickRight"
      >
      <van-icon
        v-if="left === 'setting'"
        name="setting-o"
        slot="left"
        />
    </van-nav-bar>
  </div>  
</template>

<script>
export default {
  data() {
    return {

    }
  },
  props: {
    title: {
      type: String,
      required: true
    },
    left: {
      type: String,
      required: true,
      default: "back"
    }
  },
  methods: {
    onClickLeft() {
      uni.navigateBack({
        delta: 1
      })
    }
  }
}
</script>

<style lang="less" scoped>
van-icon {
  font-size: 32rpx;
}
</style>